//package com.atguigu.consumer;
//
//import com.atguigu.entity.BirthAndDeath;
//import com.atguigu.mapper.auto.BirthAndDeathMapper;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.Map;
//
//@Component
//@RabbitListener(queues = "TestDirectQueue")//监听的队列名称 TestDirectQueue
//public class DirectReceiver2 {
//
//    @Autowired
//    private BirthAndDeathMapper birthAndDeathMapper;
//
//    @RabbitHandler
//    public void process(Map testMessage) {
//        System.out.println("######DirectReceiver2消费者收到消息  : " + testMessage.toString());
//        String messageData = String.valueOf(testMessage.get("messageData"));
//        String[] split = messageData.split(",");
//        BirthAndDeath birthAndDeath = new BirthAndDeath();
//        birthAndDeath.setDate(split[0]);
//        birthAndDeath.setName(split[1]);
//        birthAndDeath.setBirthOrDeath(split[2]);
//        birthAndDeathMapper.add(birthAndDeath);
//    }
//
//}